#ifndef ComReader_h__
#define ComReader_h__

#include "Thread.h"
#include "LoopBuffer.h"

struct EulerAngle
{
	float pitch;
	float roll;
};

class CComReader : public CSimpleThread
{
public:
	CComReader(void);
	virtual ~CComReader(void);

	static CComReader& GetInstance(void);

	BOOL Start(const char* szPortName, UINT32 dwBaudRate);

	BOOL Read(EulerAngle* Angle);

	virtual BOOL Update(void);

	virtual void OnTerminate(void);

private:
	static CComReader m_sInstance;

	HANDLE m_hPort;

	CLoopBuffer m_Buffer;
	CLoopBuffer m_PacketBuffer;
};
#endif // ComReader_h__
